package com.tdzx.entity;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.tdzx.util.StringUtils;

public class MerchanImages {

	private String username;
	private String member_id;
	private String goods_id;
	private String pic_id;
	private String user_id;
	private String pic_url;
	private String pic_date;
	private String membername;
	private String goodsname;
	private String goodsimg;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getMember_id() {
		return member_id;
	}
	public void setMember_id(String member_id) {
		this.member_id = member_id;
	}
	public String getGoods_id() {
		return goods_id;
	}
	public void setGoods_id(String goods_id) {
		this.goods_id = goods_id;
	}
	public String getPic_id() {
		return pic_id;
	}
	public void setPic_id(String pic_id) {
		this.pic_id = pic_id;
	}
	public String getUser_id() {
		return user_id;
	}
	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}
	public String getPic_url() {
		return pic_url;
	}
	public void setPic_url(String pic_url) {
		this.pic_url = pic_url;
	}
	public String getPic_date() {
		return pic_date;
	}
	public void setPic_date(String pic_date) {
		this.pic_date = pic_date;
	}
	public String getMembername() {
		return membername;
	}
	public void setMembername(String membername) {
		this.membername = membername;
	}
	public String getGoodsname() {
		return goodsname;
	}
	public void setGoodsname(String goodsname) {
		this.goodsname = goodsname;
	}
	public String getGoodsimg() {
		return goodsimg;
	}
	public void setGoodsimg(String goodsimg) {
		this.goodsimg = goodsimg;
	}
	
	public static List<MerchanImages> getMerchanImgList(String json) {
		List<MerchanImages> list = null;
		try {
			JSONObject jo = new JSONObject(json);
			if(StringUtils.isSuccessTD(json)) {
				JSONArray ja = jo.optJSONArray("resutObject");
				if(ja != null) {
					list = new ArrayList<MerchanImages>();
					for(int i = 0; i < ja.length(); i++) {
						JSONObject jo_mi = ja.optJSONObject(i);
						MerchanImages merchanImages = new MerchanImages();
						merchanImages.setGoods_id(jo_mi.optString("goods_id"));
						merchanImages.setGoodsimg(jo_mi.optString("goodsimg"));
						merchanImages.setGoodsname(jo_mi.optString("goodsname"));
						merchanImages.setMember_id(jo_mi.optString("member_id"));
						merchanImages.setMembername(jo_mi.optString("membername"));
						merchanImages.setPic_date(jo_mi.optString("pic_date"));
						merchanImages.setPic_id(jo_mi.optString("pic_id"));
						merchanImages.setPic_url(jo_mi.optString("pic_url"));
						merchanImages.setUser_id(jo_mi.optString("user_id"));
						merchanImages.setUsername(jo_mi.optString("username"));
						list.add(merchanImages);
					}
				}
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return list;
	}
}
